/**
 * ================================
 *              ReadMe
 * 1. 默认的http api后续您应该根据页面进行区分
 * 2. 本文件即作为一个示例
 * 3. 首先我们需要将axios导入
 * 4. 编写完逻辑后将api导出到../api.js中进行统一管理
 *
 * ================================
 */
import axios from '@/request/axios'

/**
 * post 方法
 * @param {*} params
 * @param config
 * @returns
 */

// 获取列表数据

export const getWork = async (config = {}) => {
  const { data: res } = await axios.get(`/auth/getWork?start_time=${config.start_time}&end_time=${config.end_time}`, {
    // params:config.params,
    loading:  config.loading || false,
    showMessage: config.loading || false
  })
  return res
}

// 单个审批并修改
export const passWord = async (config = {}) => {
  const { data: res } = await axios.post(`/auth/passWord?remark=${config.remark}&id=${config.id}&position=${config.position}&batch_number=${config.batch_number}&size=${config.size}&product_id=${config.product_id}&quantity=${config.quantity}&wage=${config.wage}&total_amount=${config.total_amount}&time=${config.time}`, {
    // params:config.params,
    loading:  config.loading || false,
    showMessage: config.loading || false
  })
  return res
}

// 驳回操作
export const rejectWork = async (config = {}) => {
  const { data: res } = await axios.post(`/auth/rejectWork?id=${config.id}&remark=${config.remark}`, {
    // params:config.params,
    loading:  config.loading || false,
    showMessage: config.loading || false
  })
  return res
}

// 批量审批
export const allPass = async (config = {}) => {
  const { data: res } = await axios.post(`/auth/allPass?id=${config.id}`, {
    loading:  config.loading || false,
    showMessage: config.loading || false
  })
  return res
}